package com.example.rwq_test.designParttern.multiThread.future;

import java.util.concurrent.TimeUnit;

/**
 * 创建真实数据的类
 *
 * @author renweiqiang
 * @version 1.0.0
 * @createTime 2022/11/15
 */
public class RealData implements Data {
    private String content;

    @Override
    public String getContent() {
        return content;
    }

    public RealData(int count, char c) {
//        System.out.println("making RealData(" + count + "," + c + ") BEGIN");
        char[] buffer = new char[count];
        for (int i = 0; i < count; i++) {
            buffer[i] = c;
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
            }
//            System.out.println("making RealData(" + count + "," + c + ") END");
            this.content = new String(buffer);
        }
    }

}
